package com.party.core.model.system;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 角色枚举
 * Created by wei.li
 *
 * @date 2017/6/26 0026
 * @time 16:23
 */
public enum RoleEnum {
    KNOWING_COMMUNE_ROLE("knowing_commune", "行知公社"),

    PARTNER_ROLE("partner", "合作商"),

    // CEO联合发起APP 联合发起个人
    COPARTNER_ROLE("copartner", "合伙代言人"),

    // CEO户外联盟APP 合作渠道
    COSPONSOR_ROLE("cosponsor", "合作渠道"),

    // CEO户外联盟APP 分销的角色（没有分销的权限）
    CHANNEL_DISTRIBUTOR_ROLE("channelDistributor", "渠道分销商"),

    // CEO户外联盟APP 分销的角色（有分销的权限）
    COPARTNER_DISTRIBUTOR_ROLE("copartnerDistributor", "有分销权限的渠道分销商"),

    PARTNER_1_ROLE("partner1", "合作商体验版"),
    PARTNER_2_ROLE("partner2", "合作商经典版"),

    COMMUNITY__ROLE("community_partner", "社群"),

    DISTRIBUTOR_ROLE("distributor", "分销商"),

    ADMIN_ROLE("admin", "管理员"),

    EXPERT_ROLE("expert", "达人"),

    ONE_LEVEL_CHILD("oneLevelChild", "一级子账号"),
    BRANCH_DIRECTOR("branchDirector", "创始理事长"),
    XZGS_ADMIN("xzgsAdmin", "分管秘书长"),
    BRANCH_MANAGER("branchManager", "分管理事长"),
    FINANCE_ROLE("finance", "公司财务"),
    BRANCH_TEAM_LEADER("branchTeamLeader","分社队长");
    //状态码
    private String code;

    //状态值
    private String value;

    RoleEnum(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (RoleEnum roleType : RoleEnum.values()) {
            if (roleType.getCode().equals(code)) {
                return roleType.getValue();
            }
        }
        return null;
    }

    public static Map<String, String> convertMap() {
        Map<String, String> map = Maps.newHashMap();
        for (RoleEnum roleType : RoleEnum.values()) {
            map.put(roleType.getCode(), roleType.getValue());
        }
        return map;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
